<me:UIPRG x:Class="WPFExcelReport.TPRG02"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:FN="clr-namespace:WPFExcelReport;assembly=TICC_FUNCTIONS"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    Background="White"  
                    x:Name="TV"
                    FontSize="14"
                    Loaded="Window_Loaded"
     >
    <me:UIPRG.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:NOTConverter  x:Key="not"/>
    </me:UIPRG.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0">
            <WrapPanel>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
            </WrapPanel>
            <WrapPanel>
                <Button Margin="10,0,0,0"  Content="{Binding Source={Localization:Translate Word=控制项复制到所有程序}}" Click="Copy2AllProgCommand"/>
                <Button  Margin="10,0,0,0"  Content="{Binding Source={Localization:Translate Word=生成系统表控制项}}" Click="CreateTableWise"/>
                <Button  Margin="10,0,0,0"  Content="{Binding Source={Localization:Translate Word=重置流水号}}" Click="ResetSeq"/>                
            </WrapPanel>
            <WrapPanel>
                <Button Margin="10,0,0,0"  Content="{Binding Source={Localization:Translate Word=替换所有项}}" Click="ReplaceControls"/>
                <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                    <SD:K8887  Grid.Column="1"  
                               IsEdit="True" 
                               KEY="{Binding CONTROLS,ElementName=TV}"/>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=请选择目标属性}}"></TextBlock>
                    <Button   Click="ReplaceControls" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>            
            </WrapPanel>
            <WrapPanel>
                <Button Margin="10,0,0,0"  Content="{Binding Source={Localization:Translate Word=复制到新程序}}" Click="Copy2ProgCommand"/>
                <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                    <FN:TSFUC  Grid.Column="1"  
                               IsEdit="True" 
                               KEY="{Binding PROG,ElementName=TV}"/>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=请选择目标程序}}"></TextBlock>
                    <Button   Click="Copy2ProgCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </WrapPanel>
            <Button   Content="{Binding Source={Localization:Translate Word=删除DEMO之外的属性}}" Click="DeleteNDEMOCommand"/>
            <WrapPanel>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=程序:}}"></TextBlock>
                    <FN:TSFUC  Grid.Column="1" 
                               Name="cFC"
                               KEY="{Binding PROG,ElementName=TV}"/>
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                        <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=属性:}}"></TextBlock>
                    <ex:TXT72 MaxLength="40" Grid.Column="1"  Text="{Binding CONTROLS}" Width="100" />
                </Grid>
                    <Grid Margin="10,0,0,0" Visibility="Collapsed">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=子控件:}}"></TextBlock>
                    <ex:TXT72 MaxLength="40" Grid.Column="1"  Text="{Binding P1}" Width="100" />
                </Grid> 
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=说明:}}"></TextBlock>
                    <ex:TXT72 MaxLength="40" Grid.Column="1" 
                              Text="{Binding REMARK,Converter={StaticResource gb2312}}" Width="200" />
                </Grid>
                
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1" Grid.Column="0"
                   VerticalAlignment="Top" 
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"  
                   ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                   IsSynchronizedWithCurrentItem="True" 
                   IsReadOnly="True"
                   x:Name="dlgMaster" 
                   RowDetailsVisibilityMode="Visible"  
                >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=MANDANT}"   Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ROWNID}" Header="{Binding Source={Localization:Translate Word=ID}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=PROG}" Header="{Binding Source={Localization:Translate Word=程序}}"  Width="100" />
                <DataGridTextColumn Binding="{Binding Path=CONTROLS}"  Header="{Binding Source={Localization:Translate Word=属性}}"  Width="80" />
                <!--DataGridTextColumn Binding="{Binding Path=P1}"  Header="{Binding Source={Localization:Translate Word=子控件}}"  Width="80" /-->
                <DataGridTextColumn Binding="{Binding Path=REMARK,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=说明}}"  Width="Auto" /> 
                <DataGridTextColumn Binding="{Binding Path=NEWUSER}" Header="{Binding Source={Localization:Translate Word=创建}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=NEWTIME}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CHGUSER}" Header="{Binding Source={Localization:Translate Word=修改}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CHGTIME}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  >
        <me:TPRG Grid.Row="0" Grid.RowSpan="2" Grid.Column="1"
                 PROG="{Binding PROG,ElementName=TV}"
            />
    </Grid>
</me:UIPRG>
